﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace CodeTunnel.MvcUtilities.Objects
{
    /// <summary>
    /// Metadata describing pages of data. Used for generating paging links.
    /// </summary>
    public class PagingInfo
    {
        /// <summary>
        /// Total number of items to be paged through.
        /// </summary>
        public int TotalItems { get; set; }

        /// <summary>
        /// Number of items to display on each page.
        /// </summary>
        public int ItemsPerPage { get; set; }

        /// <summary>
        /// Current page number.
        /// </summary>
        public int CurrentPage { get; set; }

        /// <summary>
        /// The total number of pages.
        /// </summary>
        public int TotalPages
        {
            get { return (int)Math.Ceiling((decimal)TotalItems / ItemsPerPage); }
        }
    }
}